import { useRef } from "react";

//防抖
export const useFd = () => {
  let timer = useRef(null);
  function fd(cb) {
    return (...arg) => {
      clearTimeout(timer.current);
      timer.current = setTimeout(() => {
        cb(...arg);
      }, 500);
    };
  }
  return fd;
};
